package homework;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

@SuppressWarnings({"all"})

public class HomeWork03 {
    public static void main(String[] args) {
        Map hashMap  = new HashMap();
        hashMap.put("小",6000);//int->Integer
        hashMap.put("大",8000);//int->Integer
        hashMap.put("中",10000);//int->Integer
        System.out.println(hashMap);
        hashMap.put("大",7000);
        System.out.println(hashMap);

        //keySet所有员工加薪1000
        Set keySet = hashMap.keySet();
        for (Object key :keySet) {
            hashMap.put(key,(Integer)hashMap.get(key) +1000);//向下转型
        }
        System.out.println(hashMap);

        //遍历--使用迭代器
        Set entrySet = hashMap.entrySet();
        Iterator iterator = entrySet.iterator();
        while (iterator.hasNext()) {
            Map.Entry entry = (Map.Entry) iterator.next();
            System.out.println(entry.getKey() + "===" +entry.getValue());
        }

        //遍历--增强for循环
        System.out.println("========");
        for (Object o :entrySet) {
            System.out.println("工资为：" + o);
        }

    }
}

